{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "5d904dee",
   "metadata": {},
   "source": [
    "# Example 10: Relativitistic Velocity Addition"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6465ec94",
   "metadata": {},
   "source": [
    "In this example, we will symbolically regress $f(u,v)=\\frac{u+v}{1+uv}$. In relavitity, we know the rapidity trick $f(u,v)={\\rm tanh}({\\rm arctanh}\\ u+{\\rm arctanh}\\ v)$. Can we rediscover rapidity trick with KAN?"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "94056ef6",
   "metadata": {},
   "source": [
    "Intialize model and create dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "0a59179d",
   "metadata": {},
   "outputs": [],
   "source": [
    "from kan import *\n",
    "\n",
    "# initialize KAN with G=3\n",
    "model = KAN(width=[2,1,1], grid=10, k=3)\n",
    "\n",
    "# create dataset\n",
    "f = lambda x: (x[:,[0]]+x[:,[1]])/(1+x[:,[0]]*x[:,[1]])\n",
    "dataset = create_dataset(f, n_var=2, ranges=[-0.9,0.9])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cb1f817e",
   "metadata": {},
   "source": [
    "Train KAN and plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "a87b97b0",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "train loss: 6.27e-04 | test loss: 5.79e-04 | reg: 5.51e+00 : 100%|██| 20/20 [00:04<00:00,  4.76it/s]\n"
     ]
    }
   ],
   "source": [
    "model.fit(dataset, opt=\"LBFGS\", steps=20);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "3f1cfc9d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAFICAYAAACcDrP3AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZ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YGAgfHx8mmgyoubDdWAfGBcrIoTACy+8cFPPnTp1Kg9ikl3gOrAPPKBvZXh+PxHXgT3glouV8fb2Rnx8PIQQUKmu/s9jvjI5ISGBC4rsCteB7WNcrJBer0dSUhK0Wi2EEH/bzDf/mVarxZYtWzBs2DCFJiVqOlwHto1xsVJ6vR55eXmIiYmBTqdr8JhOp0NMTAzy8/O5oMiucR3YLh5zsQGSJKG4uBilpaXw9PSEj48PD1qSw+E6sC2MCxERyY67xYiISHaMCxERyY5xISIi2TEuREQkO8aFiIhkx7gQEZHsGBciIpId40JERLJjXIiISHaMCxERyY5xISIi2TEuREQkO8aFiIhkx7gQEZHs/h8/5EnnIe3VrgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 500x400 with 6 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "model.plot(beta=10)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5ca6421a",
   "metadata": {},
   "source": [
    "Retrain the model, the loss remains similar, meaning that the locking does not degrade model behavior, justifying our hypothesis that these two activation functions are the same. Let's now determine what this function is using $\\texttt{suggest_symbolic}$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "2ccb7048",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  function  fitting r2    r2 loss  complexity  complexity loss  total loss\n",
      "0  arctanh    0.999999 -16.470396           4                4  -16.470396\n",
      "1      tan    0.999842 -12.540685           3                3  -12.540685\n",
      "2   arcsin    0.998866  -9.771875           4                4   -9.771875\n",
      "3   arccos    0.998866  -9.771725           4                4   -9.771725\n",
      "4    x^0.5    0.982258  -5.815842           2                2   -5.815842\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "('arctanh',\n",
       " (<function kan.utils.<lambda>(x)>,\n",
       "  <function kan.utils.<lambda>(x)>,\n",
       "  4,\n",
       "  <function kan.utils.<lambda>(x, y_th)>),\n",
       " 0.9999989867210388,\n",
       " 4)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.suggest_symbolic(0,1,0,weight_simple=0.0)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0092be41",
   "metadata": {},
   "source": [
    "We can see that ${\\rm arctanh}$ is at the top of the suggestion list! So we can set both to arctanh, retrain the model, and plot it."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "1bb96fe1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "r2 is 0.9999993443489075\n",
      "r2 is 0.9999989867210388\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "tensor(1.0000)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.fix_symbolic(0,0,0,'arctanh')\n",
    "model.fix_symbolic(0,1,0,'arctanh')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "83b852a3",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "train loss: 3.91e-04 | test loss: 4.70e-04 | reg: 5.54e+00 : 100%|██| 20/20 [00:02<00:00,  7.30it/s]\n"
     ]
    }
   ],
   "source": [
    "model.fit(dataset, opt=\"LBFGS\", steps=20, update_grid=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "9ccd0923",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAFICAYAAACcDrP3AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8o6BhiAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAlFklEQVR4nO3deXxU9b3/8fd3sk4IEEgjFiNKMCqIqCBLJQhcJVGprTd4XW8r1lakCAWXlqqtFAUvFBVS26rYKrgFr8EF4YIWURRs4QcKFhW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uMMerSpYvat2/f0iUCLY52EB0IlzBijNHo0aOP6r1jxoxhEhNRgXYQHVgtFmYOtL7/QFjfj2hEO4h89FzCTFpamoqKimSMkc938L8en88nY4zmzp1Lg0JUoR1EPsIlDOXl5Wn+/Pny+/0yxnynmx96ze/3a8GCBcrNzfWoUqDl0A4iG+ESpvLy8lRSUqLp06crKyur2bWsrCxNnz5dmzdvpkEhqtEOIhdzLhHAcRzt3LlT5eXlat26tdq3b8+kJWIO7SCyEC4AANcxLAYAcB3hAgBwHeECAHAd4QIAcB3hAgBwHeECAHAd4QIAcB3hAgBwHeECAHAd4QIAcB3hAgBwHeECAHAd4QIAcB3hAgBw3f8HWXndr82J2FcAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 500x400 with 6 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "model.plot(beta=10)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4b98a727",
   "metadata": {},
   "source": [
    "We will see that ${\\rm tanh}$ is at the top of the suggestion list! So we can set it to ${\\rm tanh}$, retrain the model to machine precision, plot it and finally get the symbolic formula."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "99ad38b9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  function  fitting r2    r2 loss  complexity  complexity loss  total loss\n",
      "0     tanh    0.999974 -14.743149           3                3   -0.548630\n",
      "1        x    0.945782  -4.204828           1                1   -0.040966\n",
      "2        0    0.000000   0.000014           0                0    0.000003\n",
      "3      cos    0.995867  -7.915010           2                2    0.016998\n",
      "4      sin    0.995867  -7.915010           2                2    0.016998\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "('tanh',\n",
       " (<function kan.utils.<lambda>(x)>,\n",
       "  <function kan.utils.<lambda>(x)>,\n",
       "  3,\n",
       "  <function kan.utils.<lambda>(x, y_th)>),\n",
       " 0.9999735355377197,\n",
       " 3)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.suggest_symbolic(1,0,0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "af24c80d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "r2 is 0.9999735355377197\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "tensor(1.0000)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.fix_symbolic(1,0,0,'tanh')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "01936f17",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "train loss: 6.55e-08 | test loss: 6.85e-08 | reg: 5.57e+00 : 100%|██| 20/20 [00:01<00:00, 17.11it/s]\n"
     ]
    }
   ],
   "source": [
    "model.fit(dataset, opt=\"LBFGS\", steps=20);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "76bcc188",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAFICAYAAACcDrP3AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8o6BhiAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAkUklEQVR4nO3deXiV5Z3/8c99si9AAkYUUynBlAoCKrLIYsSFWOO0Cu3oONZBaUcZlSm1dhymv4rihpfK4jI6aKfgWENtUESQOEVHVgdKWSxVBCKjIaIYcmKWQxJynt8fNycLhhDgSZ6zvF/XlQs8J6d8obnP59y7cRzHEQAALvJ5XQAAIPoQLgAA1xEuAADXES4AANcRLgAA1xEuAADXES4AANcRLgAA1xEuAADXES4AANcRLgAA1xEuAADXES4AANcRLgAA1xEuAADXxXtdABAJHMdReXm5qqurlZ6erl69eskY43VZQNii5wK0w+/3a968ecrNz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CF6LkAbiouLVVBQoEAgIMdxvjEMFnosEAiooKBAxcXFHlUKhCd6LsBR/H6/srOzFQgEFAwGmx6/QGrquWxp8f0+n08pKSkqLS1VRkZG1xYLhCl6LsBRFi5cqNra2lbB0p5gMKja2lotWrSokysDIgc9F6AFx3GUm5urkpKSbwyFHavnIknGGOXk5GjXrl0yR+ZjgFhGzwVooby8XHv27DnhpcaO42jPnj06ePBgJ1UGRBbCBWihurr6lF5fVVXlUiVAZCNcgBbS09OP+dxHskNiH7Xz+m7durldEhCRCBeghV69eql///5tzpsEZOdaAm28zhij/v37q2fPnp1dIhARCBegBWOM7rrrrpN67bRp05jMB45gtRhwlGPtczkW9rkA30TPBThKRkaGioqKZIyRz9d+E/H5fDLGaMmSJQQL0ALhArQhPz9fy5cvV0pKiowx3xjuCj2WkpKiFStWaMKECR5VCoQnwgU4hvz8fJWWlmru3LnKyclp9VxOTo7mzp2rffv2ESxAG5hzATrAcRy9++67uvzyy7Vq1SqNHz+eyXugHfRcgA4wxjTNqWRkZBAswHEQLgAA1xEuAADXES4AANcRLgAA1xEuAADXES4AANcRLgAA1xEuAADXES4AANcRLgAA1xEuAADXES4AANcRLgAA1xEuAADXES4AANcRLgAA1xEuwHE0NDRo3759+vDDDyVJe/bs0cGDBxUMBj2uDAhfXHMMHIPf71dRUZFefvll7dixQ1VVVaqvr1dycrKysrI0btw4TZkyRWPGjFF8fLzX5QJhhXAB2rBhwwZNnz5d27dv1/Dhw1VQUKAhQ4YoPT1dfr9fmzdv1rJly7R7925df/31evDBB5WVleV12UDYIFyAo7z99tuaPHmy0tPT9cgjj+jqq69WfX29CgsLVVdXp+7du+uGG25QQ0ODCgsLNXPmTA0aNEgvvfSSevfu7XX5QFggXIAWPv74Y1111VVKS0tTYWGhBg4cKGOMSkpKdOGFF6qyslL9+vXT5s2blZmZKcdxtHbtWt1444269NJL9cILLygpKcnrvwbgOSb0gSMaGxv18MMPq6KiQk8//XRTsLTHGKOxY8fqscce09KlS7Vy5couqhYI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"text/plain": [
       "<Figure size 500x400 with 6 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "model.plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "b62b0246",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\tanh{\\left(\\operatorname{atanh}{\\left(x_{1} \\right)} + \\operatorname{atanh}{\\left(x_{2} \\right)} \\right)}$"
      ],
      "text/plain": [
       "tanh(atanh(x_1) + atanh(x_2))"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "formula = model.symbolic_formula()[0][0]\n",
    "nsimplify(ex_round(formula, 4))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
